package com.itheima05;

import java.io.*;
import java.net.Socket;

public class Tcp01 {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket("127.0.0.1",10000);

        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("C:\\Users\\阳光正直夏明伟15805655221\\Pictures\\Camera Roll\\Snipaste_2021-03-14_10-10-50.png"));
        BufferedOutputStream bos=new BufferedOutputStream(socket.getOutputStream());

        int b;
        while ((b=bis.read())!=-1){
            bos.write(b);
        }

        bos.flush();
        socket.shutdownOutput();

        BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String s = br.readLine();
        System.out.println("服务器返回:"+s);

        bos.close();
        socket.close();
    }
}
